home *** CD-ROM | disk | FTP | other *** search
/ MACup: Giveaway 1996 / Image.iso / Shareware & Demos / Multimedia / Director Goodies ƒ / Sound XObject 2.1 ƒ / SIMPLE / SIMPLE.DIR / 00001.ls next >
Encoding:
Text File  |  1995-12-21  |  2.0 KB  |  89 lines

  1. on startMovie
  2.   if the machineType = 256 then
  3.     openXLib("XSOUND.DLL")
  4.   else
  5.     openXLib("Sound XObject")
  6.   end if
  7.   InitSoundXObject()
  8.   SetSoundFile()
  9. end
  10.  
  11. on stopMovie
  12.   KillSoundXObject()
  13.   if the machineType = 256 then
  14.     closeXLib("XSOUND.DLL")
  15.   else
  16.     closeXLib("Sound XObject")
  17.   end if
  18. end
  19.  
  20. on InitSoundXObject
  21.   global gSoundObject
  22.   if objectp(gSoundObject) then
  23.     gSoundObject(mdispose)
  24.   end if
  25.   set gSoundObject to XSound(mnew, 0)
  26.   gSoundObj(mRegister, "???")
  27. end
  28.  
  29. on KillSoundXObject
  30.   global gSoundObject
  31.   if objectp(gSoundObject) then
  32.     gSoundObject(mdispose)
  33.   end if
  34. end
  35.  
  36. on SetSoundFile
  37.   global gSoundObject
  38.   if the machineType = 256 then
  39.     set soundName to "TEST.WAV"
  40.   else
  41.     set soundName to "TEST.AIF"
  42.   end if
  43.   set result to gSoundObject(mSetSoundFile, the pathName & soundName, 2, 1)
  44.   if result <> 0 then
  45.     put "An error occurred while setting the sound file (" & string(result) & ")"
  46.     alert("Unable to create a sound file. If you are running this off of a CD-ROM, please copy the Sound XObject demo folder to your hard drive and run this Director movie from there.")
  47.   end if
  48.   if result = 0 then
  49.     put "ready to record" into field "status"
  50.   else
  51.     put "unable to create a sound file" into field "status"
  52.   end if
  53. end
  54.  
  55. on RecordSound
  56.   global gSoundObject
  57.   set result to gSoundObject(mRecord)
  58.   if result <> 0 then
  59.     beep()
  60.     put "An error occurred when trying to record the sound (" & string(result) & ")"
  61.   end if
  62.   if result = 0 then
  63.     put "recording a sound" into field "status"
  64.   else
  65.     put "error" into field "status"
  66.   end if
  67. end
  68.  
  69. on PlaySound
  70.   global gSoundObject
  71.   set result to gSoundObject(mPlay)
  72.   if result <> 0 then
  73.     beep()
  74.     put "An error occurred when trying to play the sound (" & string(result) & ")"
  75.   end if
  76. end
  77.  
  78. on StopSound
  79.   global gSoundObject
  80.   set result to gSoundObject(mStop)
  81.   if result <> 0 then
  82.     beep()
  83.     put "An error occurred when trying to stop the sound (" & string(result) & ")"
  84.   end if
  85.   if result = 0 then
  86.     put "ready to play or record" into field "status"
  87.   end if
  88. end
  89.